package cn.tedu;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Scanner;

/**
 * @author Administrator
 */
public class Demo6 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入英雄名:");
        String name = scanner.nextLine();
        System.out.println("请输入价格:");
        double money = scanner.nextDouble();
        try (
                Connection conn = DBUtils.getConn();
        ) {
            Statement s = conn.createStatement();
            s.execute("insert into hero values (null,'"+name+"',"+money+")");
//            s.execute("insert into hero values("+String.format("%c%s%s%f","'",name,"',",money)+")");
            System.out.println("数据输入完毕");
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
